From 19ea926cbc9a462f72fb9e072019c3ff355af1c2 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Mon, 19 Jul 2010 12:22:04 +0100 Subject: [PATCH] Improve balloon support for NetBSD. Signed-off-by: Christoph Egger --- tools/python/xen/xend/osdep.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/python/xen/xend/osdep.py b/tools/python/xen/xend/osdep.py index c3dea72a00..3a09b5244c 100644 --- a/tools/python/xen/xend/osdep.py +++ b/tools/python/xen/xend/osdep.py @@ -83,13 +83,19 @@ def _netbsd_balloon_stat(label): import commands - if label != 'current': - return None - cmd = "/sbin/sysctl hw.physmem64" + xend2netbsd_labels = { 'current' : 'kern.xen.balloon.current', + 'target' : 'kern.xen.balloon.target', + 'low-balloon' : None, + 'high-balloon' : None, + 'limit' : None } + + cmdarg = xend2netbsd_labels[label] + if cmdarg is None: + return None + cmd = "/sbin/sysctl " + cmdarg sysctloutput = commands.getoutput(cmd) (name, value) = sysctloutput.split('=') - """Return value in KB.""" - return int(value) / 1024 + return int(value) def _solaris_balloon_stat(label): """Returns the value for the named label, or None if an error occurs.""" -- 2.30.2